﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using QuanLyShop.DAO;
using QuanLyShop.DTO;

namespace QuanLyShop.BUS
{
    public class GiaBanBUS
    {
        GiaBanDAO dao = new GiaBanDAO();
        #region 1. Load danh sách giá bán
        public DataTable LayDanhSachGiaBan()
        {
            DataTable dt = null;
            try
            {
                dt = dao.LayDanhSachGiaBan();
            }
            catch (Exception e)
            {

                throw new Exception("Lỗi rồi" + e.ToString());
            }
            return dt;

        }
        #endregion

        #region 2. Thêm Giá Bán

        public int ThemGiaBan(GiaBanDTO gb)
        {
            int kq = 0;
            try
            {
                kq = dao.ThemGiaBan(gb);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return kq;

        }
        #endregion


        #region 3. Cập nhật giá bán

        public int CapNhatGiaBan(GiaBanDTO gb)
        {
            int kq = 0;
            try
            {
                kq = dao.CapNhatGiaBan(gb);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return kq;

        }
        #endregion
    }
}
